<?php
	include '../include/functions.php';
?>
<html>
  <HEAD>
    <TITLE>JoshHughes.com NFL Football Pool Site</TITLE>
    <link rel="stylesheet" href="css/NFLPool.css" type="text/css">
</head>
<body leftmargin="0" topmargin="0" bottommargin="0" rightmargin="0" marginwidth="0" marginheight="0">
<?
	//Connect To Database
	dbConnect();

		//Select users information from the Users Table
		# $SQL = "SELECT ID, username, email, PlayOffs FROM NFLUsers WHERE PlayOffs=1 ORDER BY username"; 
		$SQL = "SELECT ID, username, email FROM NFLUsers ORDER BY username"; 
		//Open Record Set using SQL Query
		$Emailresult = mysql_query($SQL) or die("Cannot query the database.<br>" . mysql_error());
		
		$url = "http://football.joshhughes.com";
		do{
		    $SendMail = false;
		    if ($Emailrow["email"] != NULL)
		    {
				$SendMail = true;
				//set up some email varibables
				$MailSubject = "Arena Football Anyone?";
				$MailBody = "Hey ".$Emailrow["username"].",\n
I am totally bummed the NFL season is over (though quite pleased with the outcome).  So I have taken the steps to create an Arena Football League Pool at http://football.joshhughes.com/AFL  The Arena Football League runs from the end of February through July, so we could have football almost all year long!  You can log in with the same username & password as before, but you do have to elect to play in this pool.  To play the AFL pool, you simply need to choose the 'edit profile' link (in the login box), check the box that says 'Play AFL', and submit the changes.  By default everyone has the NFL box checked.\n
You may be thinking 'I don't know anything about Arena Football', but neither does anyone else, and I think that will make this pool even more interesting.  The RandomMonkey has made all his picks for the season, can any of us even beat him in a league we know nothing about?  At the very leat is will help us kill time until NFL traing camps start again.\n
Several things in the AFL pool will not be 'as nice' as they are in the NFL pool, (such as the automation in emailing picks after games have started, and updating game winners and user scores directly after the games end), but the basic functions (making/changing picks, viewing breakdowns, user & team standings) are up & working [I think].  And most of the features I haven't yet converted to AFL are my responsibility anyway, like setting the game winners.  So you should be able to enjoy the AFL pool in the same way you enjoy the NFL pool.  If you click a link and you find yourself looking at the NFL layout simply click the HOME->AFL HOME link in the main menu to get back to the AFL pool.\n
It took me 4 years to build in the features we have now, and about 6 days to duplicate the AFL side.  So if you do decide to play, please bear with me and report any & all problems to me.  I am also going to be re-structuring the whole site over the (NFL) off season, moving the current site pages to http://football.joshhughes.com/NFL so going forth each league's pool will be it's own branch off of http://football.joshhughes.com.\n
For more on the Arena Football League visit www.arenafootball.com.\n\n
\n- Josh\nFootball Pool Administrator";
		    }
		    
			if($SendMail)
			{
			  $MailTo = $Emailrow["username"]." <".$Emailrow["email"].">";
			  //add From: header
			  $MailFrom = "From: Football@joshhughes.com";
			  //Send an Email notifying user
			  //mail($MailTo, $MailSubject, $MailBody, $headers);  //message send
			  mail($MailTo, $MailSubject, $MailBody, $MailFrom);  //message send
			  echo "<H1>MailTo: <i>$MailTo</i></H1>";
			}//end if($SendMail)
		}while($Emailrow = mysql_fetch_array($Emailresult));
?>
</body>
</html>
